Fractal sets patch. Second version. Bugs corrected: . Bounding slabs now work. Thank to Egon (egon@ugcs.caltech.edu) who found the bug in 'lighting.c'. This correction may arrouse problems with shadows one day, but until now, no one was detected. Well. . CSG is operational, but slows even more the computations. It can be used optionaly. . The necessary file 'tokenize.c' was not included in the previous archive. Unforgivable neglecting. Pascal. ----------------------------------------------------------------------- julia_patch_2.tar contents and description: . 'frame.h' ( new primitive fields ) . 'parse.h' ( new tokens: julia, z3 and fractal ) . 'tokenize.c' ( new tokens spelling ) . 'parse.c' ( syntax ) . 'povproto.h' ( prototype for routines in 'julia.c' ) . 'julia.c' ( primitive routines ) . 'lighting.c' ( Lines 269 and 270 have been changed to make bounding slabs work.) These files should replace those in the POV-ray 2.2 sources. Add the primitive 'julia.c' in the Makefile before re-compiling. Syntax: { C.x, C.y, C.z, C.w, n, s (,csg) USUAL_TRANSFORMATIONS USUAL_TEXTURES ... } where is either: julia, z3 or fractal. The fractal is generated by taking the point (x,y,z,0.0) in 4D space (quaternion) and iterating a certain map, which depends on the four parameters given by C.x, C.y, C.z and C.w. If, after n iterations, the iterated point did not get out of the bounding sphere (radius=2), the initial point is in the set. For 'julia' set, the map is : z -> z^2 + C For 'z3' set, it is: z -> z^3 + C For 'fractal' set, the map is currently: | x | x^2-y^2-z^2-w^2 | y | 2*w*y | z ----> | 2*x*z + C | w | 2*y*z but it can be changed at will in 'julia.c'. Look at routines: 'Iteration_Fractal' and 'Normal_Calc_Fractal'... The integer s gives the number of steps in which is a ray divided in inside the sphere. Each point is tested, starting from eye, until a likely intersection is detected. The higher s, the slower, but smoother will look the set... 300 is commonly a good value. A better algo would use distance-estimator to perform the tests, and be much faster, but that does not work for any iteration map, or when the initial point is *inside* the set. If someone wants to enhance that point... I'll try when I find time :( csg: this keyword is optional and must be used when the fractal set takes part in a CSG operation. Because, in such case, *all* intersection points (or at least the MAX_INTERSECTIONS first ones. Check in file 'parse.h' if problems) must be detected. It is therefore much slower. Hope you'll enjoy, even if it is a slow primitive... Pascal. ------------------------------ Pascal Massimino Ecole Normale Superieure 45, rue d'Ulm 75005 Paris. Pascal.Massimino@ens.fr (any comments/bugs/enhancements welcome ) http://acacia.ens.fr:8080/home/massimin/index.ang.html